<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>重置登录密码</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.js"></script>
	</head>

	<body>
		<form class="layui-form update_form" action="">
			<div class="layui-form-item">
				<label class="layui-form-label">原密码</label>
				<div class="layui-input-block update_shurk">
					<input type="password" name="jiupwd" id="jiupwd" required lay-verify="required" placeholder="原登录密码" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">新密码</label>
				<div class="layui-input-block update_shurk">
					<input type="password" name="xinpwd" id="xinpwd" required lay-verify="required" placeholder="新登录密码" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item update_btnbox">
				<div class="layui-input-block">
					<button class="layui-btn" type="button" id="tijiao">提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</body>

</html>
<script>
	layui.use('form', function() {
		var form = layui.form;
	});
</script>
<script>
	$('#tijiao').click(function() {
		var xinpwd =  $('#xinpwd').val();
		var jiupwd =  $('#jiupwd').val();
		
		if(xinpwd.trim()==""){
			layer.msg('新密码不能为空');
			return ;
		}
		
		if(jiupwd.trim()==""){
			layer.msg('旧密码不能为空');
			return ;
		}
		
		if(xinpwd.trim()== jiupwd.trim()){
			layer.msg('新密码不能和旧密码一致');
		}
		
		$.ajax({
			type: 'post',
			data: {
				xinpwd: $('#xinpwd').val(),
				jiupwd: $('#jiupwd').val()
			},
			url: "{:url('index/return_password')}",
			success: function(data) {
				if(data.code == 200) {
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					}, function() {
						window.parent.location.reload();
					});
				} else {
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
				}
			}
		});
	});
</script>